package b1.project.order.service.impl;

import b1.project.order.entity.OrderEntity;
import b1.project.order.entity.table.OrderEntityDef;
import b1.project.order.mapper.OrderMapper;
import b1.project.order.service.OrderService;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author sun
 * @date 2025/7/21 09:44
 */
@Service
public class OrderServiceImpl  extends ServiceImpl<OrderMapper, OrderEntity> implements OrderService{
    @Autowired
    OrderMapper orderMapper;
    @Override
    public OrderEntity create(String orderId) {
        OrderEntityDef orderEntity1 = OrderEntityDef.orderEntity;
        list(orderEntity1.id.eq(orderId));
        OrderEntity orderEntity = new OrderEntity();
        orderEntity.setId(orderId);
        orderEntity.setProductName("测试商品");
        orderEntity.setPrice(new BigDecimal(100));
        orderMapper.insert(orderEntity);
        return orderEntity;
    }
}